package algorithm.queue;

import java.util.LinkedList;
import java.util.List;

public class MyQueue {

    private final List<Integer> list;

    /**
     * Initialize your data structure here.
     */
    public MyQueue() {
        this.list = new LinkedList<>();
    }


    /**
     * Push element x to the back of queue.
     */
    public void push(int x) {
        list.add(x);
    }

    /**
     * Removes the element from in front of queue and returns that element.
     */
    public int pop() {
        Integer integer = list.get(0);
        list.remove(0);
        return integer;
    }

    /**
     * Get the front element.
     */
    public int peek() {
        return list.get(0);
    }

    /**
     * Returns whether the queue is empty.
     */
    public boolean empty() {
        return list.isEmpty();
    }


}
